package com.maktoub.apiinterfaceproject.service.impl;

import com.maktoub.apiclientstart.entity.HelloGetListParam;
import com.maktoub.apiclientstart.entity.PostInputParamTest;
import com.maktoub.apiinterfaceproject.common.BaseResponse;
import com.maktoub.apiinterfaceproject.service.InterfaceService;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;

/**
 * @author Maktoub
 * @description 针对表【user(用户)】的数据库操作Service实现
 * @createDate 2024-05-13 17:52:15
 */
@Service
public class InterfaceServiceImpl
        implements InterfaceService {

    @Override
    public BaseResponse<String> sayHelloPost(PostInputParamTest inputParams, HttpServletRequest request) {
        String name = inputParams.getName();
        String sex = inputParams.getSex();
        String res=null;
        if(sex==null){
            res="接入hello接口成功===> Hello " + name +" sex请输入男、女或者boy、girl";
        }
        else {
            switch (sex) {
                case "女":
                    res = "接入hello接口成功===> Hello " + name + " 你是一个好看的" + sex + "生";
                    break;
                case "girl":
                    res = "接入hello接口成功===> Hello " + name + " you are a pretty " + sex;
                    break;
                case "男":
                    res = "接入hello接口成功===> Hello " + name + " 你是一个巨帅的" + sex + "生";
                    break;
                case "boy":
                    res = "接入hello接口成功===> Hello " + name + " you are a handsome " + sex;
                    break;
                default:
                    res = "接入hello接口成功===> Hello " + name + " sex请输入男、女或者boy、girl";
            }
        }
        return new BaseResponse<String>(200, res, "ok");

    }

    @Override
    public BaseResponse<String> sayHelloGetList(HelloGetListParam helloGetListParam, HttpServletRequest request) {
        String res = "接入hello 接口成功===> Hello  " + helloGetListParam.getName() + "+ " + helloGetListParam.getAge() + "岁的你";
        return new BaseResponse<>(200, res, "ok");
    }


}




